package com.tcp2.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Author: 杨俊辉
 * Time: 2014-11-22 15:53
 * Copyright (C) 2014 Xiamen Yaxon Networks CO.,LTD.
 */
public class Md5Util {

    /**
     * MD5加密
     * @param password
     * @return
     */
    public static String makeMD5(String password)
    {
        MessageDigest md;
        try{
            md= MessageDigest.getInstance("MD5");
            md.update(password.getBytes());
            String pwd=new BigInteger(1,md.digest()).toString(16);
            return pwd;
        }catch (NoSuchAlgorithmException e){
            e.printStackTrace();
        }
        return password;
    }

}
